package com.woniu.supermarket.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.supermarket.mapper.SalesReturnMapper;
import com.woniu.supermarket.service.ISalesReturnService;
import com.woniu.supermarket.vo.SalesReturnVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SalesReturnServiceImpl implements ISalesReturnService {

    @Autowired
    SalesReturnMapper salesReturnMapper;

    @Override
    public PageInfo<SalesReturnVo> findByCons(Integer now, Integer size, String saleReturnCode) {
        PageHelper.startPage(now,size);
        List<SalesReturnVo> lists = salesReturnMapper.selectByCons(saleReturnCode);
        return new PageInfo<>(lists);
    }

    @Override
    public void reset(SalesReturnVo salesReturn) {
        salesReturnMapper.updatePriceByPrimaryKey(salesReturn);
    }
}
